-
Notifications
You must be signed in to change notification settings - Fork 0
Testplane testing library #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Testplane testing library #1
Conversation
0d093af to
644394c
Compare
644394c to
9a2d1df
Compare
shadowusr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really cool overall, but a few fixes are needed! Great job!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not related to this file: having .nvmrc is a must. Right now after checking out this repo it's not clear which Node version should be used for development.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
package.json
Outdated
| "license": "MIT", | ||
| "homepage": "https://github.com/gemini-testing/testplane-testing-library#readme", | ||
| "peerDependencies": { | ||
| "testplane": "^8.29.6" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this requirement so high? Wouldn't it work with 8.0.0? Ideally, it should. Can you please check & lower this requirement if possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set to 8.25.3. and tested
package.json
Outdated
| "eslint": "^9.26.0", | ||
| "globals": "^16.1.0", | ||
| "prettier": "^3.5.3", | ||
| "serve-handler": "^6.1.6", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do we use this package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
| "watch": "tsc --watch", | ||
| "reformat": "prettier --write .", | ||
| "check-formatting": "prettier --check .", | ||
| "lint": "eslint ." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's useful to have "prepack": "npm run build" script here as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
README.md
Outdated
| @@ -1,0 +1,54 @@ | |||
| # Testplane testing library | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's adopt a unified README style that we use across our repos. Here are logos for this repo:
Other things like badges you may copy from our mcp repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed for logo
README.md
Outdated
| ## Introduction | ||
| [Testing-library](https://testing-library.com/) is a collection of tools for testing web application user interfaces, focused on creating reliable and maintainable tests by emphasizing user behavior. The main advantage of `testing-library` is its focus on interaction with interface elements. And in testplane, you can use the element search methods provided by the `testing-library` itself. | ||
|
|
||
| ## Connection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think connection has a slightly different meaning, imo "installation" fits better here, but not critical to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
README.md
Outdated
|
|
||
| ## Connection | ||
|
|
||
| 1. Install the npm package `@testplane/testing-library` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
colon is missing at the end of the line (not critical)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
|
||
| ## Usage | ||
|
|
||
| After configuring, you will be able to use the search by selectors from `testing-library`, as described in the [official documentation](https://testing-library.com/docs/queries/about/). For example, searching for an element by its text: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a disclaimer here that as of now all testing-library selectors return a promise and cannot be chained (like browser.getByText().click() — this is not possible). Each testing-library selector must be awaited before performing any actions on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
| // eslint-disable-next-line @typescript-eslint/no-namespace | ||
| namespace WebdriverIO { | ||
| // eslint-disable-next-line @typescript-eslint/no-empty-object-type | ||
| interface Element extends TestplaneQueries {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another issue I've stumbled upon when trying to use this package is ENOENT error. Here's what I did:
- checked out this repo,
npm ci+npm run build+npm packto get tgz of this package. - switched to my testing project and installed this tgz like this
npm i -D @testplane/[email protected] - Written this test:
it('should take a screenshot', async ({browser}) => {
await browser.url('https://example.com/');
const element = await (browser as any).getByText('Example Domain');
await element.assertView('target-block');
});
Got this error:
Promise: Promise {
<rejected> Error: ENOENT: no such file or directory, open '/Users/shadowusr/dev/tp-ts-playground/node_modules/@testplane/testing-library/node_modules/@testing-library/dom/dist/@testing-library/dom.umd.js'
at Object.openSync (node:fs:573:18)
at Object.readFileSync (node:fs:452:35)
at Object.<anonymous> (/Users/shadowusr/dev/tp-ts-playground/node_modules/@testplane/testing-library/build/index.js:32:46)
at Module._compile (node:internal/modules/cjs/loader:1469:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
at Object.require.extensions.<computed> [as .js] (/Users/shadowusr/dev/tp-ts-playground/node_modules/ts-node/src/index.ts:1608:43)
at Module.load (node:internal/modules/cjs/loader:1288:32)
at Function.Module._load (node:internal/modules/cjs/loader:1104:12)
at Module.require (node:internal/modules/cjs/loader:1311:19)
at require (node:internal/modules/helpers:179:18)
at Object.<anonymous> (/Users/shadowusr/dev/tp-ts-playground/.testplane.conf.ts:2:1)
at Module._compile (node:internal/modules/cjs/loader:1469:14)
at Module.m._compile (/Users/shadowusr/dev/tp-ts-playground/node_modules/ts-node/src/index.ts:1618:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
at Object.require.extensions.<computed> [as .ts] (/Users/shadowusr/dev/tp-ts-playground/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1288:32) {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/Users/shadowusr/dev/tp-ts-playground/node_modules/@testplane/testing-library/node_modules/@testing-library/dom/dist/@testing-library/dom.umd.js'
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
b5ead1c to
445950f
Compare

No description provided.